import React from 'react';
import { Modal, Button,} from 'antd';
import './index.css'
import { Input } from 'antd';
import { connect } from 'react-redux'
import {caddOne} from '../../redux/classFicationg/classFication'
import {TransportAddClass} from '../../redux/transportClass/transportClass'
@connect(
    state => state,
    { caddOne,TransportAddClass }
)
export default class AddClassModel extends React.Component {
    constructor(){
        super();
    }
    onAdd(){
        let classificationName = document.getElementById('add').value;
        if(this.props.value === 1){
            this.props.caddOne(classificationName)
        }else{
            this.props.TransportAddClass(classificationName)
        }
        
    }
    render() {
        
        return (
            <Modal
              title="新增分类"
              visible={this.props.visible}
              onOk={this.handleOk}
              footer={null}
              wrapClassName="submiss"
              onCancel={()=>this.props.showModel()}
            >
             <div style={{width:'100%',margin:'0 auto',textAlign:'center'}}>
               分类名称: <Input id='add' placeholder="必填" style={{width:200}}/>
               <div style={{paddingBottom:20,paddingTop:20}}><Button onClick = {this.onAdd.bind(this)} type="primary">立即提交</Button></div>
             </div>
            </Modal>
        );
    }
}